<html>
	<head>
		<title>Hello!</title>
		<script language="javascript">
			/*
			document.getElementById() 	Returns the element that has the ID attribute with the specified value
			document.getElementsByName() 	Accesses all elements with a specified name
			document.getElementsByTagName() 	Returns a NodeList containing all elements with the specified tagname
			*/
			
			function startProgram() {
			
				var aCoolDiv = window.document.getElementById("mydiv");
				aCoolDiv.style.fontSize = "20pt";
				
				var spans = window.document.getElementsByTagName("span");
				for (var i = 0; i < spans.length; i++) {
					spans[i].style.color = "red";
					spans[i].style.fontWeight = "bolder";
				}
				
				
			}
			
			function fixMe() {
				var aCoolDiv = window.document.getElementById("mydiv");
				if (aCoolDiv.style.fontSize == "") {
					aCoolDiv.style.fontSize = "20pt";
				}
				else {
					aCoolDiv.style.fontSize = "";
				}
			}
			
			function askStupidQuestion(e) {
				var isThisGuyStupid = confirm("Are you a freaking moron?");
				if (isThisGuyStupid) {
					alert("You are a moron!");
					window.document.title = "Hello, Moron!";
				}
				else {
					alert("You arn't so stupid after all!");
					window.document.title = "Hello, Genius!";
					changeColor(e);
				}
			}
			
			function changeColor(e) {
				var red = Math.floor(Math.random() * 255);
				var green = Math.floor(Math.random() * 255);
				var blue = Math.floor(Math.random() * 255); 
				document.body.style.backgroundColor = "rgb(" + red + ", " + green + ", " + blue + ")";
				
				//if (e.which) {
				//	var aCoolDiv = window.document.getElementById("mydiv");
				//	aCoolDiv.innerHTML += String.fromCharCode(e.which);
				//}
			}
			
		</script>
	</head>
	<body onload="startProgram()" onkeydown="changeColor(event)">
		<h1>WELCOME!</h1>
		<div onclick="fixMe()" id="mydiv" onmousemove="changeColor(event)" style="border:1px dotted black;background-color:green;color:white;">
			This is a stupid box.
		</div>
		<p>
			This is cool. This is cool. This is cool. <span onclick="askStupidQuestion(event)">This is cool.</span> This is cool. This is cool. <span>This is cool.</span> This is cool. 
		</p>
		<div style="width:1000px;height:1000px; border:2px solid orange">asdfasdf</div>
		
	</body>
</html>